<%@ page language="java" import="java.util.*,com.anhry.app.safety.util.Util" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>下达通知</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">	
	<link href="<%=basePath+Util.SKIN%>/css/right.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/check_jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/util.js"></script>
	<script src="<%=basePath%>/js/oa.js" type="text/javascript"></script>
   	<script type="text/javascript" src="<%=basePath%>/js/dbdialog/lhgdialog.min.js<%=Util.LHGDIALOG%>"></script>
	<style>
		li{float:left;list-style:none;height:25px;padding-top:3px;}
		.rname{float:left;width:99%;height:70px;border:1px #aaa solid;overflow:scroll;background:#fefefe;list-style:none;margin-top:3px;padding:5px;margin-left: 5px}
		.menuitem {float:left;POSITION: absolute; VISIBILITY: hidden;width:80%;}
		.menuitem1 {float:left;POSITION: static; VISIBILITY: visible;width:80%;}
	</style>
	<script type="text/javascript">
	/*
	window.onload = function(){
	//function openDialog(){
	   var user = J('#btn1').dialog({id:'userlist', title:'接收人列表-管理员', width:860, height:520, cover:true, page:'<%=path%>/oa/notice_userList.action' });
	   var corp = J('#btn2').dialog({id:'corplist', title:'接收人列表-企业', width:960, height:520, cover:true, page:'<%=path%>/oa/notice_corpList.action' });
	} 
	*/
	$(document).ready(function(){
		$("#btn1").click(function() {
			infoDialog('接收人列表-管理员','900px','358px', '<%=basePath%>/oa/notice_userList.action');
		});
		$("#btn2").click(function() {
			infoDialog('接收人列表-企业','900px','358px', '<%=basePath%>/oa/notice_corpList.action');
		});
		$("#addMore").click(function(){//附件添加
			var td = document.getElementById("more");	
			var br = document.createElement("br");
			var input = document.createElement("input");
			var button = document.createElement("input");			
			input.type = "file";
			input.name = "myFile";
			input.size = "60";
			button.type = "button";
			button.value = "删除";	
			button.onclick = function(){
				td.removeChild(br);
				td.removeChild(input);
				td.removeChild(button);
			}			
			td.appendChild(br);
			td.appendChild(input);
			td.appendChild(button);	
		});
	});
	
	
	//删除收件人
	function deleteChooseCorp(id){
		var userIds = $("#addcorp").val();
		$("#c"+id).remove();
		
		var selectedIds = "";
		var ids = userIds.split(",");
		for(i=0;i<ids.length;i++){
	   		if(ids[i] != id){
				selectedIds += ids[i] + ",";
	   		}
		}
		selectedIds = selectedIds.substring(0, selectedIds.length-1);
		$("#addcorp").val(selectedIds);
	}
	function deleteChooseUser(id){
		var userIds = $("#adduse").val();
		$("#"+id).remove();
		
		var selectedIds = "";
		var ids = userIds.split(",");
		for(i=0;i<ids.length;i++){
	   		if(ids[i] != id){
				selectedIds += ids[i] + ",";
	   		}
		}
		selectedIds = selectedIds.substring(0, selectedIds.length-1);
		$("#adduse").val(selectedIds);
	}
	function deleCorp(id){//删除企业
		var corpIds = document.getElementById('addcorp');
		document.getElementById('c_'+id).parentNode.removeChild(document.getElementById('c_'+id));
		var mv=corpIds.value;
		var videoIds = "";
		var ids = mv.split(",");
		for(i=0;i<ids.length;i++){
	   		if(ids[i] == id){
				ids.splice(i,1);
	   		}
		}
		for(i=0;i<ids.length;i++){
	   		if(i!=ids.length-1) {
				videoIds+=ids[i]+",";				
			}else {
				videoIds+=ids[i];				
				break;
			}			
		}
		corpIds.value = videoIds;
	}
	function deleCorps(id){//删除符合条件的企业
		var selectIds = document.getElementById('addselect');
		selectIds.value="";
		document.getElementById(id).style.display="none";
	}
	function toSend(){
		if(document.noticeForm.addUser.value=="" && document.noticeForm.addCorp.value=="" && document.noticeForm.corpSelect.value==""){
			alert('请选择接收者！');
			return false;
		}
		//if(document.noticeForm.noteContent.value.length>100){
		//	alert('短信提醒内容不能大于100字');
		//	return false;
		//}
		//document.noticeForm.submit();
		return true;
		
	}
	</script>
  </head>
  
  <body>
        <div class="body-box">
        <div class="map">
			<div class="map_con">
				您当前的位置：协同办公 &gt; 公告通知 &gt; 新通知 
			</div>
		</div>
		
		<div id="container">
			<s:set name="userGrade" value="#session.adminuser.tbUserRole.tbUserGrade.id"></s:set>
		    <form name="noticeForm" action="<%=basePath%>/oa/notice_noticeSaveOrUpdate.action" method="post" enctype="multipart/form-data" onsubmit="waitingDialog();">	    	
		    	<table border="0" cellspacing="0" cellpadding="0"  width="100%" class="info_table">
					<tr>
						<td colspan="2" class="title_li">新通知</td>
					</tr>
					<tr>
						<td width="100" class="title_td">接收者：</td>
						
						<td style="padding-bottom:3px;">
							<li>
							<s:if test="%{#userGradeId!=6&&userGradeId!=7}">
								<input type="button" name="bt1" value="管理机构" id="btn1" class="link_input"/>		
							</s:if>
							<s:if test="%{#userGrade!=2}">
								<input type="button" name="bt2" value="企 业" id="btn2" class="link_input"/>	
							</s:if>					
							</li>
							<span id="add" class="rname"><span id="corp1span"></span><span id="userspan"></span><span id="corpspan"></span></span>
						</td>
					</tr>
					<tr>
						<td class="title_td">标题：</td>
						<td ><input name="noticeTitle" type="text"  size="70%" class="info_input" id="bit1"><span class="note4">*</span></td>
					</tr>				
					<tr>
						<td class="title_td">紧急程度：</td>
						<td ><s:radio list="#{0:'普通',1:'紧急'}" theme="simple" listKey="key" listValue="value" name="isExigence" value="0"></s:radio></td>
					</tr>				
					<tr>
						<td class="title_td">是否短信提醒：</td>
						<td ><s:radio list="#{0:'否',1:'是'}"  id="isRN" theme="simple" listKey="key" listValue="value" name="isNote" value="0"></s:radio>
							<div id="span1" class="menuitem">启动时间（接收后多久未读）<input type="text" name="noteDay" value="0" size="1" id="bnumber1"/><span class="note4"></span> 天 <input type="text" name="noteHour" value="0" size="1" id="bnumber2"/><span class="note4"></span>小时<input type="text" name="noteSec" value="0" size="1" id="bnumber3"/><span class="note4"></span>分钟&nbsp;&nbsp;(注：如无间隔时间，请全部填写为"0")						
							<s:if test="%{#userGrade!=2}">
								<br/>企业接收人：<s:radio list="#{0:'负责人',1:'安全负责人'}"   listKey="key" listValue="value" theme="simple" name="isCorper" value="0"></s:radio>
							</s:if>		
							<br/>提醒内容：<br/><textarea rows="3" cols="50" name="noteContent" id="noteCon"></textarea><label id="wordNum" class="note4">字数不能超过100字</label>
							</div>	
						</td>
					</tr>				
					<tr>
						<td class="title_td">附件：</td>
						<td id="more"><input type="button" name="am1" value="添加附件" id="addMore" class="link_input"/> </td>
					</tr>
<%--					<tr>	--%>
<%--						<td class="title_td">内容：</td>--%>
<%--						<td >--%>
<%--							<FCK:editor instanceName="noticeContent" width="99%" height="300" toolbarSet="Basic">--%>
<%--								<jsp:attribute name="value"></jsp:attribute>--%>
<%--								<jsp:body><FCK:config id="cmbSkins" SkinPath="skins/office2003/" /></jsp:body>--%>
<%--					        </FCK:editor>--%>
<%--						</td>--%>
<%--					</tr>	--%>
					<tr>	
						<td class="title_td">内容：</td>
						<td >
							<div style="margin-left: 5px">
								<textarea name="noticeContent" style="display:none"></textarea>
								<iframe id="eWebEditor1" src="<%=Util.EDITOR_BASE_URL %>/ewebeditor/ewebeditor.htm?id=noticeContent&style=standard600&skin=office2003" frameborder="0" scrolling="no" width="600" height="350"></iframe> 
							</div>
						</td>
					</tr>			
				</table>
				<table border="0" cellspacing="0" cellpadding="0"  width="100%" style="float:left; padding-top:15px;padding-bottom:5px;">
					<tr>
						<td align="center"><input type="submit" id="btnSubmit1" class="link_input" value="提 交" onclick="return toSend()"/></td>
					</tr>
				</table>
				<input type="hidden" name="addUser" value="" id="adduse">
		    	<input type="hidden" name="addCorp" value="" id="addcorp">
		    	<input type="hidden" name="corpSelect" value="" id="addselect">	
		    </form>
		    <!-- 
	</div>
	    <div class="right_bottom">
			<div style="width:11px;float:left"><img src="<%=basePath%>/images/right_bottom.gif"/></div>
			<div style="width:16px;float:right"><img src="<%=basePath%>/images/right_rbottom.gif"/></div>
		</div>
	</div>
	   -->
  </body>
</html>
